﻿using UnityEngine;
using System.Collections;

public class ataqueDisparoSimple : MonoBehaviour {
	public GameObject bala;
	public Transform posicion;
	public float intervalo;
	public float fuerza = 220;

	void atacar(){
		InvokeRepeating("disparar",1,2);
	}

	void disparar(){
		GameObject objBala = Instantiate(bala,posicion.position,Quaternion.identity) as GameObject;
		objBala.rigidbody.AddForce(posicion.right*fuerza);
	}

	void detenerAtaque(){
		CancelInvoke();
	}
}
